package com.ysd.lis.controller.bac;

import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.bac.BacResistantPhenotypeDict;
import com.ysd.lis.entity.sta.StaResistantPhenotype;
import com.ysd.lis.request.bac.BacGermBaseDictRequest;
import com.ysd.lis.service.bac.BacResistantPhenotypeDictService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 耐药表型
 *
 * @author LuoXS
 * @date 2024/3/27
 * version 1.0
 */
@RestController
@RequestMapping("/lis/bac/base/resistant-phenotype/dict")
public class BacResistantPhenotypeDictController extends BaseController {


    @Autowired
    BacResistantPhenotypeDictService service;


    @ApiOperation("获取微生物基础字典-耐药表型列表（分页）")
    @GetMapping("/page")
    public Result pageList(BacGermBaseDictRequest.BacResistantPhenotypeDictPageParam pageParam) {
        return service.pageList(pageParam);
    }

    @ApiOperation("获取微生物基础字典-耐药表型列表")
    @GetMapping("/findDictList")
    public Result findDictList(BacResistantPhenotypeDict pageParam) {
        return service.findDictList(pageParam);
    }


    @ApiOperation("新增")
    @PostMapping("/add")
    @LogDetail(requestParam = "add", operationType = OperationType.INSERT, module = "微生物基础字典-耐药表型", content = "新增耐药表型", businessName = "bacBase")
    public Result add(@RequestBody BacResistantPhenotypeDict dict) {
        return service.add(dict);
    }

    @ApiOperation("修改")
    @PostMapping("/update")
    @LogDetail(requestParam = "update", operationType = OperationType.INSERT, module = "微生物基础字典-耐药表型", content = "编辑耐药表型", businessName = "bacBase")
    public Result update(@RequestBody BacResistantPhenotypeDict dict) {
        return service.updateDict(dict);
    }

    @ApiOperation("删除")
    @PostMapping("/delete")
    @LogDetail(requestParam = "delete", operationType = OperationType.INSERT, module = "微生物基础字典-耐药表型", content = "删除耐药表型", businessName = "bacBase")
    public Result delete(@RequestBody BacGermBaseDictRequest.BacResistantPhenotypeDictDeleteParam deleteParam) {
        return service.delete(deleteParam);
    }

    @ApiOperation("标准库创建")
    @PostMapping("/staDataResistantPhenotype")
    public Result staDataResistantPhenotype(@RequestBody List<StaResistantPhenotype> staResistantPhenotypes) {
        return service.staDataResistantPhenotype(staResistantPhenotypes);
    }

}
